﻿using EasyLucky.Dal.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyLucky.Dal.Dal
{
    public class WinnerDal:BaseDal
    {
        public List<WinnerEntity> QueryAll()
        {
            var db = GetClient();
            var Winners = db.Queryable<WinnerEntity>().ToList();
            return Winners;
        }

        public int AddWinner(WinnerEntity Winner)
        {
            var db = GetClient();
            int id = db.Insertable<WinnerEntity>(Winner).ExecuteReturnIdentity();
            return id;
        }

        public int DeleteWinner(WinnerEntity Winner)
        {
            var db = GetClient();
            int cnt = db.Deleteable<WinnerEntity>(Winner.Id).ExecuteCommand();
            return cnt;
        }

        public int UpdateWinner(WinnerEntity Winner)
        {
            var db = GetClient();
            int cnt = db.Updateable<WinnerEntity>(Winner).ExecuteCommand();
            return cnt;
        }
    }
}
